﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;



class TitleResource
{
    public Int32 id { get; set; }
    public Int32 name_id { get; set; }
    public Int32 tooltip_id { get; set; }
    public Int32 status_id { get; set; }
    public Byte rate { get; set; }
    public Int16 opt_type_0 { get; set; }
    public Single opt_var1_0 { get; set; }
    public Single opt_var2_0 { get; set; }
    public Int16 opt_type_1 { get; set; }
    public Single opt_var1_1 { get; set; }
    public Single opt_var2_1 { get; set; }
    public Int16 opt_type_2 { get; set; }
    public Single opt_var1_2 { get; set; }
    public Single opt_var2_2 { get; set; }
    public Int16 opt_type_3 { get; set; }
    public Single opt_var1_3 { get; set; }
    public Single opt_var2_3 { get; set; }
    public Int16 opt_type_4 { get; set; }
    public Single opt_var1_4 { get; set; }
    public Single opt_var2_4 { get; set; }
    public Int16 opt_type_5 { get; set; }
    public Single opt_var1_5 { get; set; }
    public Single opt_var2_5 { get; set; }
    public Int16 opt_type_6 { get; set; }
    public Single opt_var1_6 { get; set; }
    public Single opt_var2_6 { get; set; }
    public Int16 opt_type_7 { get; set; }
    public Single opt_var1_7 { get; set; }
    public Single opt_var2_7 { get; set; }
    public Int32 effect_id { get; set; }
    public Int32 local_flag { get; set; }
    public Byte is_periodic { get; set; }
    public DateTime begin_of_period { get; set; }
    public DateTime end_of_period { get; set; }


    public void ReadFile(BinaryReader br)
    {
        this.id = br.ReadInt32();
        this.name_id = br.ReadInt32();
        this.tooltip_id = br.ReadInt32();
        this.status_id = br.ReadInt32();
        this.rate = br.ReadByte();
        this.opt_type_0 = br.ReadInt16();
        this.opt_type_1 = br.ReadInt16();
        this.opt_type_2 = br.ReadInt16();
        this.opt_type_3 = br.ReadInt16();
        this.opt_type_4 = br.ReadInt16();
        this.opt_type_5 = br.ReadInt16();
        this.opt_type_6 = br.ReadInt16();
        this.opt_type_7 = br.ReadInt16();
        this.opt_var1_0 = br.ReadSingle();
        this.opt_var1_1 = br.ReadSingle();
        this.opt_var1_2 = br.ReadSingle();
        this.opt_var1_3 = br.ReadSingle();
        this.opt_var1_4 = br.ReadSingle();
        this.opt_var1_5 = br.ReadSingle();
        this.opt_var1_6 = br.ReadSingle();
        this.opt_var1_7 = br.ReadSingle();
        this.opt_var2_0 = br.ReadSingle();
        this.opt_var2_1 = br.ReadSingle();
        this.opt_var2_2 = br.ReadSingle();
        this.opt_var2_3 = br.ReadSingle();
        this.opt_var2_4 = br.ReadSingle();
        this.opt_var2_5 = br.ReadSingle();
        this.opt_var2_6 = br.ReadSingle();
        this.opt_var2_7 = br.ReadSingle();
        this.effect_id = br.ReadInt32();
        this.local_flag = br.ReadInt32();

        if (br.ReadByte() == 255)
        {
            this.is_periodic = 1;
        }
        else
        {
            this.is_periodic = 0;
        }

        this.begin_of_period = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(br.ReadInt32());
        this.end_of_period = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(br.ReadInt32());
    }

}

